//
//  MXLoginSettingTableViewCell.m
//  MXLoginMethodsDomo
//
//  Created by 马彦 on 16/9/26.
//  Copyright © 2016年 MX. All rights reserved.
//

#import "MXLoginSettingTableViewCell.h"
#import <Masonry.h>

@interface MXLoginSettingTableViewCell ()

@property (nonatomic, weak) UILabel *mainLbl;
@property (nonatomic, weak) UILabel *stateLbl;
@property (nonatomic, weak) UIImageView *arrowImgView;

@end

@implementation MXLoginSettingTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configureUI];
    }
    return self;
}

- (void)configureUI {
    UILabel *mainLbl = [[UILabel alloc] init];
    mainLbl.textColor = [UIColor blackColor];
    mainLbl.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:mainLbl];
    self.mainLbl = mainLbl;
    
    UILabel *stateLbl = [[UILabel alloc] init];
    stateLbl.textColor = RGBA_Color(0.67, 0.67, 0.67, 1.0);
    stateLbl.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:stateLbl];
    self.stateLbl = stateLbl;
    
    UIImageView *arrowImgView = [[UIImageView alloc] init];
    arrowImgView.image = [UIImage imageNamed:@"rightArrow"];
    [self.contentView addSubview:arrowImgView];
    self.arrowImgView = arrowImgView;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [self.mainLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(14);
    }];
    [self.stateLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.arrowImgView.mas_left).offset(-10);
        make.centerY.mas_equalTo(self.mainLbl.mas_centerY);
        make.height.mas_equalTo(14);
    }];
    [self.arrowImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.width.mas_equalTo(7);
        make.height.mas_equalTo(13);
        make.centerY.mas_equalTo(self.stateLbl.mas_centerY);
    }];
}

- (void)setMainStr:(NSString *)mainStr {
    self.mainLbl.text = mainStr;
}

- (void)setStateStr:(NSString *)stateStr {
    self.stateLbl.text = stateStr;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
